package com.huan.controller;

import com.huan.VO.AddArticleDto;
import com.huan.VO.LinkVo;
import com.huan.domain.ResponseResult;
import com.huan.domain.entity.Link;
import com.huan.service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/content/link")
public class LinkController {
    @Autowired
    private LinkService linkService;
    @GetMapping("/list")
    public ResponseResult getAllList(Integer pageNum, Integer pageSize, String name, String status){
        return linkService.getAllList(pageNum,pageSize,name,status);
    }
    @PostMapping
    public ResponseResult add(@RequestBody Link linkVo){
        return linkService.add(linkVo);
    }
    @GetMapping("{id}")
    public ResponseResult getLink(@PathVariable Long id){
        return linkService.getLink(id);
    }
    @PutMapping
    public ResponseResult uplink(@RequestBody Link link){return linkService.uplink(link);}
    @DeleteMapping("{id}")
    public ResponseResult deleteLink(@PathVariable Long id){
        return linkService.deleteLink(id);
    }
}
